<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.10.0" />
<title>py3dtilers.GeojsonTiler.geojson API documentation</title>
<meta name="description" content="" />
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
</head>
<body>
<main>
<article id="content">
<header>
<h1 class="title">Module <code>py3dtilers.GeojsonTiler.geojson</code></h1>
</header>
<section id="section-intro">
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python"># -*- coding: utf-8 -*-
import numpy as np
from earclip import triangulate

from ..Common import Feature, FeatureList


# The GeoJson file contains the ground surface of urban elements, mainly buildings.
# Those elements are called &#34;features&#34;, each feature has its own ground coordinates.
# The goal here is to take those coordinates and create a box from it.
# To do this, we compute the center of the lower face
# Then we create the triangles of this face
# and duplicate it with a Z offset to create the upper face
# Then we create the side triangles to connect the upper and the lower faces
class Geojson(Feature):
    &#34;&#34;&#34;
    The Python representation of a GeoJSON feature.
    A Geojson instance has a geometry and properties.
    &#34;&#34;&#34;

    n_feature = 0

    # Default height will be used if no height is found when parsing the data
    default_height = 2

    # Default Z will be used if no Z is found in the feature coordinates
    default_z = 0

    # Those values are used to set the color of the features
    attribute_values = list()  # Contains all the values of a semantic attribute
    attribute_min = np.Inf  # Contains the min value of a numeric attribute
    attribute_max = np.NINF  # Contains the max value of a numeric attribute

    def __init__(self, id=None, feature_properties=None, feature_geometry=None):
        super().__init__(id)

        self.feature_properties = feature_properties
        self.feature_geometry = feature_geometry

        self.height = 0
        &#34;&#34;&#34;How high we extrude the polygon when creating the 3D geometry&#34;&#34;&#34;

        self.polygon = list()
        self.custom_triangulation = False

    def custom_triangulate(self, coordinates):
        &#34;&#34;&#34;
        Custom triangulation method used when we triangulate buffered lines.
        :param coordinates: an array of 3D points ([x, y, Z])

        :return: a list of triangles
        &#34;&#34;&#34;
        triangles = list()
        length = len(coordinates)

        for i in range(0, (length // 2) - 1):
            triangles.append([coordinates[i], coordinates[length - 1 - i], coordinates[i + 1]])
            triangles.append([coordinates[i + 1], coordinates[length - 1 - i], coordinates[length - 2 - i]])

        return triangles

    def set_z(self, coordinates, z):
        &#34;&#34;&#34;
        Set the Z value of each coordinate of the feature.
        The Z can be the name of a property to read in the feature or a float.
        :param coordinates: the coordinates of the feature
        :param z: the value of the z
        &#34;&#34;&#34;
        z_value = Geojson.default_z
        if z != &#39;NONE&#39;:
            if z.replace(&#39;.&#39;, &#39;&#39;, 1).isdigit():
                z_value = float(z)
            else:
                if z in self.feature_properties:
                    z_value = self.feature_properties[z]
                else:
                    print(&#34;No propertie called &#34; + z + &#34; in feature &#34; + str(Geojson.n_feature) + &#34;. Set Z to default value (&#34; + str(Geojson.default_z) + &#34;).&#34;)
        for coord in coordinates:
            if len(coord) &lt; 3:
                coord.append(z_value)
            elif z != &#39;NONE&#39;:
                coord[2] = z_value

    def parse_geojson(self, target_properties, is_roof=False, color_attribute=(&#39;NONE&#39;, &#39;numeric&#39;)):
        &#34;&#34;&#34;
        Parse a feature to extract the height and the coordinates of the feature.
        :param target_properties: the names of the properties to read
        :param Boolean is_roof: False when the coordinates are on floor level
        &#34;&#34;&#34;
        # Current feature number (used for debug)
        Geojson.n_feature += 1

        # If precision is equal to 9999, it means Z values of the features are missing, so we skip the feature
        prec_name = target_properties[target_properties.index(&#39;prec&#39;) + 1]
        if prec_name != &#39;NONE&#39;:
            if prec_name in self.feature_properties:
                if self.feature_properties[prec_name] &gt;= 9999.:
                    return False

        height_name = target_properties[target_properties.index(&#39;height&#39;) + 1]
        if height_name.replace(&#39;.&#39;, &#39;&#39;, 1).isdigit():
            self.height = float(height_name)
        else:
            if height_name in self.feature_properties:
                if self.feature_properties[height_name] &gt; 0:
                    self.height = self.feature_properties[height_name]
                else:
                    self.height = Geojson.default_height
            else:
                print(&#34;No propertie called &#34; + height_name + &#34; in feature &#34; + str(Geojson.n_feature) + &#34;. Set height to default value (&#34; + str(Geojson.default_height) + &#34;).&#34;)
                self.height = Geojson.default_height

        if color_attribute[0] in self.feature_properties:
            attribute = self.feature_properties[color_attribute[0]]
            if color_attribute[1] == &#39;numeric&#39;:
                if attribute &gt; Geojson.attribute_max:
                    Geojson.attribute_max = attribute
                if attribute &lt; Geojson.attribute_min:
                    Geojson.attribute_min = attribute
            else:
                if attribute not in Geojson.attribute_values:
                    Geojson.attribute_values.append(attribute)

    def parse_geom(self):
        &#34;&#34;&#34;
        Creates the 3D extrusion of the feature.
        &#34;&#34;&#34;
        height = self.height
        coordinates = self.polygon
        length = len(coordinates)

        triangles = list()
        vertices = [None] * (2 * length)

        for i, coord in enumerate(coordinates):
            vertices[i] = np.array([coord[0], coord[1], coord[2]])
            vertices[i + length] = np.array([coord[0], coord[1], coord[2] + height])

        # Triangulate the feature footprint
        if self.custom_triangulation:
            poly_triangles = self.custom_triangulate(coordinates)
        else:
            poly_triangles = triangulate(coordinates)

        # Create upper face triangles
        for tri in poly_triangles:
            upper_tri = [np.array([coord[0], coord[1], coord[2] + height]) for coord in tri]
            triangles.append(upper_tri)

        # Create side triangles
        for i in range(0, length):
            triangles.append([vertices[i], vertices[length + i], vertices[length + ((i + 1) % length)]])
            triangles.append([vertices[i], vertices[length + ((i + 1) % length)], vertices[((i + 1) % length)]])

        self.geom.triangles.append(triangles)
        self.set_box()

    def get_geojson_id(self):
        return super().get_id()

    def set_geojson_id(self, id):
        return super().set_id(id)


class Geojsons(FeatureList):
    &#34;&#34;&#34;
    A decorated list of Geojson instances.
    &#34;&#34;&#34;

    def __init__(self, objects=None):
        super().__init__(objects)

    @staticmethod
    def parse_geojsons(features, properties, is_roof=False, color_attribute=(&#39;NONE&#39;, &#39;numeric&#39;)):
        &#34;&#34;&#34;
        Create 3D features from the GeoJson features.
        :param features: the features to parse from the GeoJSON
        :param properties: the properties used when parsing the features
        :param is_roof: substract the height from the features coordinates

        :return: a list of triangulated Geojson instances.
        &#34;&#34;&#34;
        feature_list = list()

        for feature in features:
            if not feature.parse_geojson(properties, is_roof, color_attribute):
                continue

            # Create geometry as expected from GLTF from an geojson file
            feature.parse_geom()
            feature_list.append(feature)

        return Geojsons(features)</code></pre>
</details>
</section>
<section>
</section>
<section>
</section>
<section>
</section>
<section>
<h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson"><code class="flex name class">
<span>class <span class="ident">Geojson</span></span>
<span>(</span><span>id=None, feature_properties=None, feature_geometry=None)</span>
</code></dt>
<dd>
<div class="desc"><p>The Python representation of a GeoJSON feature.
A Geojson instance has a geometry and properties.</p>
<p>:param id: given identifier</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class Geojson(Feature):
    &#34;&#34;&#34;
    The Python representation of a GeoJSON feature.
    A Geojson instance has a geometry and properties.
    &#34;&#34;&#34;

    n_feature = 0

    # Default height will be used if no height is found when parsing the data
    default_height = 2

    # Default Z will be used if no Z is found in the feature coordinates
    default_z = 0

    # Those values are used to set the color of the features
    attribute_values = list()  # Contains all the values of a semantic attribute
    attribute_min = np.Inf  # Contains the min value of a numeric attribute
    attribute_max = np.NINF  # Contains the max value of a numeric attribute

    def __init__(self, id=None, feature_properties=None, feature_geometry=None):
        super().__init__(id)

        self.feature_properties = feature_properties
        self.feature_geometry = feature_geometry

        self.height = 0
        &#34;&#34;&#34;How high we extrude the polygon when creating the 3D geometry&#34;&#34;&#34;

        self.polygon = list()
        self.custom_triangulation = False

    def custom_triangulate(self, coordinates):
        &#34;&#34;&#34;
        Custom triangulation method used when we triangulate buffered lines.
        :param coordinates: an array of 3D points ([x, y, Z])

        :return: a list of triangles
        &#34;&#34;&#34;
        triangles = list()
        length = len(coordinates)

        for i in range(0, (length // 2) - 1):
            triangles.append([coordinates[i], coordinates[length - 1 - i], coordinates[i + 1]])
            triangles.append([coordinates[i + 1], coordinates[length - 1 - i], coordinates[length - 2 - i]])

        return triangles

    def set_z(self, coordinates, z):
        &#34;&#34;&#34;
        Set the Z value of each coordinate of the feature.
        The Z can be the name of a property to read in the feature or a float.
        :param coordinates: the coordinates of the feature
        :param z: the value of the z
        &#34;&#34;&#34;
        z_value = Geojson.default_z
        if z != &#39;NONE&#39;:
            if z.replace(&#39;.&#39;, &#39;&#39;, 1).isdigit():
                z_value = float(z)
            else:
                if z in self.feature_properties:
                    z_value = self.feature_properties[z]
                else:
                    print(&#34;No propertie called &#34; + z + &#34; in feature &#34; + str(Geojson.n_feature) + &#34;. Set Z to default value (&#34; + str(Geojson.default_z) + &#34;).&#34;)
        for coord in coordinates:
            if len(coord) &lt; 3:
                coord.append(z_value)
            elif z != &#39;NONE&#39;:
                coord[2] = z_value

    def parse_geojson(self, target_properties, is_roof=False, color_attribute=(&#39;NONE&#39;, &#39;numeric&#39;)):
        &#34;&#34;&#34;
        Parse a feature to extract the height and the coordinates of the feature.
        :param target_properties: the names of the properties to read
        :param Boolean is_roof: False when the coordinates are on floor level
        &#34;&#34;&#34;
        # Current feature number (used for debug)
        Geojson.n_feature += 1

        # If precision is equal to 9999, it means Z values of the features are missing, so we skip the feature
        prec_name = target_properties[target_properties.index(&#39;prec&#39;) + 1]
        if prec_name != &#39;NONE&#39;:
            if prec_name in self.feature_properties:
                if self.feature_properties[prec_name] &gt;= 9999.:
                    return False

        height_name = target_properties[target_properties.index(&#39;height&#39;) + 1]
        if height_name.replace(&#39;.&#39;, &#39;&#39;, 1).isdigit():
            self.height = float(height_name)
        else:
            if height_name in self.feature_properties:
                if self.feature_properties[height_name] &gt; 0:
                    self.height = self.feature_properties[height_name]
                else:
                    self.height = Geojson.default_height
            else:
                print(&#34;No propertie called &#34; + height_name + &#34; in feature &#34; + str(Geojson.n_feature) + &#34;. Set height to default value (&#34; + str(Geojson.default_height) + &#34;).&#34;)
                self.height = Geojson.default_height

        if color_attribute[0] in self.feature_properties:
            attribute = self.feature_properties[color_attribute[0]]
            if color_attribute[1] == &#39;numeric&#39;:
                if attribute &gt; Geojson.attribute_max:
                    Geojson.attribute_max = attribute
                if attribute &lt; Geojson.attribute_min:
                    Geojson.attribute_min = attribute
            else:
                if attribute not in Geojson.attribute_values:
                    Geojson.attribute_values.append(attribute)

    def parse_geom(self):
        &#34;&#34;&#34;
        Creates the 3D extrusion of the feature.
        &#34;&#34;&#34;
        height = self.height
        coordinates = self.polygon
        length = len(coordinates)

        triangles = list()
        vertices = [None] * (2 * length)

        for i, coord in enumerate(coordinates):
            vertices[i] = np.array([coord[0], coord[1], coord[2]])
            vertices[i + length] = np.array([coord[0], coord[1], coord[2] + height])

        # Triangulate the feature footprint
        if self.custom_triangulation:
            poly_triangles = self.custom_triangulate(coordinates)
        else:
            poly_triangles = triangulate(coordinates)

        # Create upper face triangles
        for tri in poly_triangles:
            upper_tri = [np.array([coord[0], coord[1], coord[2] + height]) for coord in tri]
            triangles.append(upper_tri)

        # Create side triangles
        for i in range(0, length):
            triangles.append([vertices[i], vertices[length + i], vertices[length + ((i + 1) % length)]])
            triangles.append([vertices[i], vertices[length + ((i + 1) % length)], vertices[((i + 1) % length)]])

        self.geom.triangles.append(triangles)
        self.set_box()

    def get_geojson_id(self):
        return super().get_id()

    def set_geojson_id(self, id):
        return super().set_id(id)</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
<li><a title="py3dtilers.Common.feature.Feature" href="../Common/feature.html#py3dtilers.Common.feature.Feature">Feature</a></li>
</ul>
<h3>Subclasses</h3>
<ul class="hlist">
<li><a title="py3dtilers.GeojsonTiler.geojson_line.GeojsonLine" href="geojson_line.html#py3dtilers.GeojsonTiler.geojson_line.GeojsonLine">GeojsonLine</a></li>
<li><a title="py3dtilers.GeojsonTiler.geojson_polygon.GeojsonPolygon" href="geojson_polygon.html#py3dtilers.GeojsonTiler.geojson_polygon.GeojsonPolygon">GeojsonPolygon</a></li>
</ul>
<h3>Class variables</h3>
<dl>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.attribute_max"><code class="name">var <span class="ident">attribute_max</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.attribute_min"><code class="name">var <span class="ident">attribute_min</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.attribute_values"><code class="name">var <span class="ident">attribute_values</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.default_height"><code class="name">var <span class="ident">default_height</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.default_z"><code class="name">var <span class="ident">default_z</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.n_feature"><code class="name">var <span class="ident">n_feature</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
</dl>
<h3>Instance variables</h3>
<dl>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.height"><code class="name">var <span class="ident">height</span></code></dt>
<dd>
<div class="desc"><p>How high we extrude the polygon when creating the 3D geometry</p></div>
</dd>
</dl>
<h3>Methods</h3>
<dl>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.custom_triangulate"><code class="name flex">
<span>def <span class="ident">custom_triangulate</span></span>(<span>self, coordinates)</span>
</code></dt>
<dd>
<div class="desc"><p>Custom triangulation method used when we triangulate buffered lines.
:param coordinates: an array of 3D points ([x, y, Z])</p>
<p>:return: a list of triangles</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def custom_triangulate(self, coordinates):
    &#34;&#34;&#34;
    Custom triangulation method used when we triangulate buffered lines.
    :param coordinates: an array of 3D points ([x, y, Z])

    :return: a list of triangles
    &#34;&#34;&#34;
    triangles = list()
    length = len(coordinates)

    for i in range(0, (length // 2) - 1):
        triangles.append([coordinates[i], coordinates[length - 1 - i], coordinates[i + 1]])
        triangles.append([coordinates[i + 1], coordinates[length - 1 - i], coordinates[length - 2 - i]])

    return triangles</code></pre>
</details>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.get_geojson_id"><code class="name flex">
<span>def <span class="ident">get_geojson_id</span></span>(<span>self)</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def get_geojson_id(self):
    return super().get_id()</code></pre>
</details>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.parse_geojson"><code class="name flex">
<span>def <span class="ident">parse_geojson</span></span>(<span>self, target_properties, is_roof=False, color_attribute=('NONE', 'numeric'))</span>
</code></dt>
<dd>
<div class="desc"><p>Parse a feature to extract the height and the coordinates of the feature.
:param target_properties: the names of the properties to read
:param Boolean is_roof: False when the coordinates are on floor level</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def parse_geojson(self, target_properties, is_roof=False, color_attribute=(&#39;NONE&#39;, &#39;numeric&#39;)):
    &#34;&#34;&#34;
    Parse a feature to extract the height and the coordinates of the feature.
    :param target_properties: the names of the properties to read
    :param Boolean is_roof: False when the coordinates are on floor level
    &#34;&#34;&#34;
    # Current feature number (used for debug)
    Geojson.n_feature += 1

    # If precision is equal to 9999, it means Z values of the features are missing, so we skip the feature
    prec_name = target_properties[target_properties.index(&#39;prec&#39;) + 1]
    if prec_name != &#39;NONE&#39;:
        if prec_name in self.feature_properties:
            if self.feature_properties[prec_name] &gt;= 9999.:
                return False

    height_name = target_properties[target_properties.index(&#39;height&#39;) + 1]
    if height_name.replace(&#39;.&#39;, &#39;&#39;, 1).isdigit():
        self.height = float(height_name)
    else:
        if height_name in self.feature_properties:
            if self.feature_properties[height_name] &gt; 0:
                self.height = self.feature_properties[height_name]
            else:
                self.height = Geojson.default_height
        else:
            print(&#34;No propertie called &#34; + height_name + &#34; in feature &#34; + str(Geojson.n_feature) + &#34;. Set height to default value (&#34; + str(Geojson.default_height) + &#34;).&#34;)
            self.height = Geojson.default_height

    if color_attribute[0] in self.feature_properties:
        attribute = self.feature_properties[color_attribute[0]]
        if color_attribute[1] == &#39;numeric&#39;:
            if attribute &gt; Geojson.attribute_max:
                Geojson.attribute_max = attribute
            if attribute &lt; Geojson.attribute_min:
                Geojson.attribute_min = attribute
        else:
            if attribute not in Geojson.attribute_values:
                Geojson.attribute_values.append(attribute)</code></pre>
</details>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.parse_geom"><code class="name flex">
<span>def <span class="ident">parse_geom</span></span>(<span>self)</span>
</code></dt>
<dd>
<div class="desc"><p>Creates the 3D extrusion of the feature.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def parse_geom(self):
    &#34;&#34;&#34;
    Creates the 3D extrusion of the feature.
    &#34;&#34;&#34;
    height = self.height
    coordinates = self.polygon
    length = len(coordinates)

    triangles = list()
    vertices = [None] * (2 * length)

    for i, coord in enumerate(coordinates):
        vertices[i] = np.array([coord[0], coord[1], coord[2]])
        vertices[i + length] = np.array([coord[0], coord[1], coord[2] + height])

    # Triangulate the feature footprint
    if self.custom_triangulation:
        poly_triangles = self.custom_triangulate(coordinates)
    else:
        poly_triangles = triangulate(coordinates)

    # Create upper face triangles
    for tri in poly_triangles:
        upper_tri = [np.array([coord[0], coord[1], coord[2] + height]) for coord in tri]
        triangles.append(upper_tri)

    # Create side triangles
    for i in range(0, length):
        triangles.append([vertices[i], vertices[length + i], vertices[length + ((i + 1) % length)]])
        triangles.append([vertices[i], vertices[length + ((i + 1) % length)], vertices[((i + 1) % length)]])

    self.geom.triangles.append(triangles)
    self.set_box()</code></pre>
</details>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.set_geojson_id"><code class="name flex">
<span>def <span class="ident">set_geojson_id</span></span>(<span>self, id)</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def set_geojson_id(self, id):
    return super().set_id(id)</code></pre>
</details>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojson.set_z"><code class="name flex">
<span>def <span class="ident">set_z</span></span>(<span>self, coordinates, z)</span>
</code></dt>
<dd>
<div class="desc"><p>Set the Z value of each coordinate of the feature.
The Z can be the name of a property to read in the feature or a float.
:param coordinates: the coordinates of the feature
:param z: the value of the z</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def set_z(self, coordinates, z):
    &#34;&#34;&#34;
    Set the Z value of each coordinate of the feature.
    The Z can be the name of a property to read in the feature or a float.
    :param coordinates: the coordinates of the feature
    :param z: the value of the z
    &#34;&#34;&#34;
    z_value = Geojson.default_z
    if z != &#39;NONE&#39;:
        if z.replace(&#39;.&#39;, &#39;&#39;, 1).isdigit():
            z_value = float(z)
        else:
            if z in self.feature_properties:
                z_value = self.feature_properties[z]
            else:
                print(&#34;No propertie called &#34; + z + &#34; in feature &#34; + str(Geojson.n_feature) + &#34;. Set Z to default value (&#34; + str(Geojson.default_z) + &#34;).&#34;)
    for coord in coordinates:
        if len(coord) &lt; 3:
            coord.append(z_value)
        elif z != &#39;NONE&#39;:
            coord[2] = z_value</code></pre>
</details>
</dd>
</dl>
<h3>Inherited members</h3>
<ul class="hlist">
<li><code><b><a title="py3dtilers.Common.feature.Feature" href="../Common/feature.html#py3dtilers.Common.feature.Feature">Feature</a></b></code>:
<ul class="hlist">
<li><code><a title="py3dtilers.Common.feature.Feature.get_batchtable_data" href="../Common/feature.html#py3dtilers.Common.feature.Feature.get_batchtable_data">get_batchtable_data</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.get_bounding_volume_box" href="../Common/feature.html#py3dtilers.Common.feature.Feature.get_bounding_volume_box">get_bounding_volume_box</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.get_centroid" href="../Common/feature.html#py3dtilers.Common.feature.Feature.get_centroid">get_centroid</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.get_geom" href="../Common/feature.html#py3dtilers.Common.feature.Feature.get_geom">get_geom</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.get_geom_as_triangles" href="../Common/feature.html#py3dtilers.Common.feature.Feature.get_geom_as_triangles">get_geom_as_triangles</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.get_id" href="../Common/feature.html#py3dtilers.Common.feature.Feature.get_id">get_id</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.get_texture" href="../Common/feature.html#py3dtilers.Common.feature.Feature.get_texture">get_texture</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.has_texture" href="../Common/feature.html#py3dtilers.Common.feature.Feature.has_texture">has_texture</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.set_batchtable_data" href="../Common/feature.html#py3dtilers.Common.feature.Feature.set_batchtable_data">set_batchtable_data</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.set_box" href="../Common/feature.html#py3dtilers.Common.feature.Feature.set_box">set_box</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.set_id" href="../Common/feature.html#py3dtilers.Common.feature.Feature.set_id">set_id</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.set_texture" href="../Common/feature.html#py3dtilers.Common.feature.Feature.set_texture">set_texture</a></code></li>
<li><code><a title="py3dtilers.Common.feature.Feature.set_triangles" href="../Common/feature.html#py3dtilers.Common.feature.Feature.set_triangles">set_triangles</a></code></li>
</ul>
</li>
</ul>
</dd>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojsons"><code class="flex name class">
<span>class <span class="ident">Geojsons</span></span>
<span>(</span><span>objects=None)</span>
</code></dt>
<dd>
<div class="desc"><p>A decorated list of Geojson instances.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class Geojsons(FeatureList):
    &#34;&#34;&#34;
    A decorated list of Geojson instances.
    &#34;&#34;&#34;

    def __init__(self, objects=None):
        super().__init__(objects)

    @staticmethod
    def parse_geojsons(features, properties, is_roof=False, color_attribute=(&#39;NONE&#39;, &#39;numeric&#39;)):
        &#34;&#34;&#34;
        Create 3D features from the GeoJson features.
        :param features: the features to parse from the GeoJSON
        :param properties: the properties used when parsing the features
        :param is_roof: substract the height from the features coordinates

        :return: a list of triangulated Geojson instances.
        &#34;&#34;&#34;
        feature_list = list()

        for feature in features:
            if not feature.parse_geojson(properties, is_roof, color_attribute):
                continue

            # Create geometry as expected from GLTF from an geojson file
            feature.parse_geom()
            feature_list.append(feature)

        return Geojsons(features)</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
<li><a title="py3dtilers.Common.feature.FeatureList" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList">FeatureList</a></li>
</ul>
<h3>Static methods</h3>
<dl>
<dt id="py3dtilers.GeojsonTiler.geojson.Geojsons.parse_geojsons"><code class="name flex">
<span>def <span class="ident">parse_geojsons</span></span>(<span>features, properties, is_roof=False, color_attribute=('NONE', 'numeric'))</span>
</code></dt>
<dd>
<div class="desc"><p>Create 3D features from the GeoJson features.
:param features: the features to parse from the GeoJSON
:param properties: the properties used when parsing the features
:param is_roof: substract the height from the features coordinates</p>
<p>:return: a list of triangulated Geojson instances.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">@staticmethod
def parse_geojsons(features, properties, is_roof=False, color_attribute=(&#39;NONE&#39;, &#39;numeric&#39;)):
    &#34;&#34;&#34;
    Create 3D features from the GeoJson features.
    :param features: the features to parse from the GeoJSON
    :param properties: the properties used when parsing the features
    :param is_roof: substract the height from the features coordinates

    :return: a list of triangulated Geojson instances.
    &#34;&#34;&#34;
    feature_list = list()

    for feature in features:
        if not feature.parse_geojson(properties, is_roof, color_attribute):
            continue

        # Create geometry as expected from GLTF from an geojson file
        feature.parse_geom()
        feature_list.append(feature)

    return Geojsons(features)</code></pre>
</details>
</dd>
</dl>
<h3>Inherited members</h3>
<ul class="hlist">
<li><code><b><a title="py3dtilers.Common.feature.FeatureList" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList">FeatureList</a></b></code>:
<ul class="hlist">
<li><code><a title="py3dtilers.Common.feature.FeatureList.add_material" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.add_material">add_material</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.add_materials" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.add_materials">add_materials</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.change_crs" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.change_crs">change_crs</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.create_batch_table_extension" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.create_batch_table_extension">create_batch_table_extension</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.create_bounding_volume_extension" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.create_bounding_volume_extension">create_bounding_volume_extension</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.delete_features_ref" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.delete_features_ref">delete_features_ref</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.get_centroid" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.get_centroid">get_centroid</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.get_color_config" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.get_color_config">get_color_config</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.get_features" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.get_features">get_features</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.get_material" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.get_material">get_material</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.get_material_index" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.get_material_index">get_material_index</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.get_textures" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.get_textures">get_textures</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.is_list_of_feature_list" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.is_list_of_feature_list">is_list_of_feature_list</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.is_material_registered" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.is_material_registered">is_material_registered</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.scale_features" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.scale_features">scale_features</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.set_color_config" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.set_color_config">set_color_config</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.set_features" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.set_features">set_features</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.set_features_geom" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.set_features_geom">set_features_geom</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.set_materials" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.set_materials">set_materials</a></code></li>
<li><code><a title="py3dtilers.Common.feature.FeatureList.translate_features" href="../Common/feature.html#py3dtilers.Common.feature.FeatureList.translate_features">translate_features</a></code></li>
</ul>
</li>
</ul>
</dd>
</dl>
</section>
</article>
<nav id="sidebar">
<h1>Index</h1>
<div class="toc">
<ul></ul>
</div>
<ul id="index">
<li><h3>Super-module</h3>
<ul>
<li><code><a title="py3dtilers.GeojsonTiler" href="index.html">py3dtilers.GeojsonTiler</a></code></li>
</ul>
</li>
<li><h3><a href="#header-classes">Classes</a></h3>
<ul>
<li>
<h4><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson" href="#py3dtilers.GeojsonTiler.geojson.Geojson">Geojson</a></code></h4>
<ul class="two-column">
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.attribute_max" href="#py3dtilers.GeojsonTiler.geojson.Geojson.attribute_max">attribute_max</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.attribute_min" href="#py3dtilers.GeojsonTiler.geojson.Geojson.attribute_min">attribute_min</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.attribute_values" href="#py3dtilers.GeojsonTiler.geojson.Geojson.attribute_values">attribute_values</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.custom_triangulate" href="#py3dtilers.GeojsonTiler.geojson.Geojson.custom_triangulate">custom_triangulate</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.default_height" href="#py3dtilers.GeojsonTiler.geojson.Geojson.default_height">default_height</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.default_z" href="#py3dtilers.GeojsonTiler.geojson.Geojson.default_z">default_z</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.get_geojson_id" href="#py3dtilers.GeojsonTiler.geojson.Geojson.get_geojson_id">get_geojson_id</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.height" href="#py3dtilers.GeojsonTiler.geojson.Geojson.height">height</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.n_feature" href="#py3dtilers.GeojsonTiler.geojson.Geojson.n_feature">n_feature</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.parse_geojson" href="#py3dtilers.GeojsonTiler.geojson.Geojson.parse_geojson">parse_geojson</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.parse_geom" href="#py3dtilers.GeojsonTiler.geojson.Geojson.parse_geom">parse_geom</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.set_geojson_id" href="#py3dtilers.GeojsonTiler.geojson.Geojson.set_geojson_id">set_geojson_id</a></code></li>
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojson.set_z" href="#py3dtilers.GeojsonTiler.geojson.Geojson.set_z">set_z</a></code></li>
</ul>
</li>
<li>
<h4><code><a title="py3dtilers.GeojsonTiler.geojson.Geojsons" href="#py3dtilers.GeojsonTiler.geojson.Geojsons">Geojsons</a></code></h4>
<ul class="">
<li><code><a title="py3dtilers.GeojsonTiler.geojson.Geojsons.parse_geojsons" href="#py3dtilers.GeojsonTiler.geojson.Geojsons.parse_geojsons">parse_geojsons</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
</footer>
</body>
</html>